/** Unit test program to test the EventProcessor and Messaging capablities */

#define NUM_WORKERS 10
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>

#include "Master.h"
#include "DistributedCounter.h"
#include "TwoWayList.cc"

int main(void){

	string wordToSearch("hello");	
	Master master(wordToSearch,(char *)"example.txt");
	master.ForkAndSpin(); 

	DistributedCounter dCounter(NUM_WORKERS);

	TwoWayList <EventProcessor> myWorkers;
	for (int i=0; i<NUM_WORKERS; ++i) {
		Worker newWorker(master, dCounter);
		newWorker.ForkAndSpin();
		myWorkers.Insert(newWorker);
	}

	master.WaitForProcessorDeath(); 

	return 0;
}
